﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using Command;
using Entity;

namespace DAL
{
    public class T_Login
    {
        //用户登入查询
        public static SqlDataReader Log(UserInfo us)
        {
            string sql = string.Format("select * from UserInfo where UserName ='{0}' and UserPwd='{1}'", us.UserName, us.UserPwd);
            return DBHelper.Getdata(sql);
        }
        //用户注册
        public static bool Registered(UserInfo us)
        {
            string sql = string.Format("insert UserInfo values('{0}','{1}','2','1','{2}','{3}','{4}','{5}','{6}','{7}')",us.UserName,us.UserPwd,us.InfoName,us.InfoSex,us.InfoDate,us.InfoMail,us.InfoPhone,us.InfoAddress);
            return DBHelper.Adddata(sql) > 0;
        }
        //注册账号信息是否存在
        public static SqlDataReader LogCheck(UserInfo us)
        {
            string sql = string.Format("select * from UserInfo where UserName ='{0}'", us.UserName);
            return DBHelper.Getdata(sql);
        }
    }
}
